/*******************************************************************************
 * Copyright (c) 2022 BestSolution.at and others.
 *  
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v.2.0 which is available at
 * https://www.eclipse.org/legal/epl-2.0.
 *  
 * SPDX-License-Identifier: EPL-2.0
 *  
 * Contributors:
 *     BestSolution.at - initial API and implementation
 *******************************************************************************/
/*
 * generated by Xtext
 */
package org.eclipse.fx.ide.gmodel.ui.contentassist.antlr;

import java.util.Collection;
import java.util.Map;
import java.util.HashMap;

import org.antlr.runtime.RecognitionException;
import org.eclipse.xtext.AbstractElement;
import org.eclipse.xtext.ui.editor.contentassist.antlr.AbstractContentAssistParser;
import org.eclipse.xtext.ui.editor.contentassist.antlr.FollowElement;
import org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;

import com.google.inject.Inject;

import org.eclipse.fx.ide.gmodel.services.GModelDSLGrammarAccess;

public class GModelDSLParser extends AbstractContentAssistParser {
	
	@Inject
	private GModelDSLGrammarAccess grammarAccess;
	
	private Map<AbstractElement, String> nameMappings;
	
	@Override
	protected org.eclipse.fx.ide.gmodel.ui.contentassist.antlr.internal.InternalGModelDSLParser createParser() {
		org.eclipse.fx.ide.gmodel.ui.contentassist.antlr.internal.InternalGModelDSLParser result = new org.eclipse.fx.ide.gmodel.ui.contentassist.antlr.internal.InternalGModelDSLParser(null);
		result.setGrammarAccess(grammarAccess);
		return result;
	}
	
	@Override
	protected String getRuleName(AbstractElement element) {
		if (nameMappings == null) {
			nameMappings = new HashMap<AbstractElement, String>() {
				private static final long serialVersionUID = 1L;
				{
					put(grammarAccess.getGDomainElementAccess().getAlternatives_4(), "rule__GDomainElement__Alternatives_4");
					put(grammarAccess.getGDomainMapAccess().getAlternatives_1(), "rule__GDomainMap__Alternatives_1");
					put(grammarAccess.getGDomainMapAccess().getBuiltInAlternatives_1_0_0(), "rule__GDomainMap__BuiltInAlternatives_1_0_0");
					put(grammarAccess.getGDomainPropertyAccess().getAlternatives_0(), "rule__GDomainProperty__Alternatives_0");
					put(grammarAccess.getGDomainPropertyAccess().getBuiltInAlternatives_0_0_0_0(), "rule__GDomainProperty__BuiltInAlternatives_0_0_0_0");
					put(grammarAccess.getGDefaultAccess().getAlternatives(), "rule__GDefault__Alternatives");
					put(grammarAccess.getGModelAccess().getGroup(), "rule__GModel__Group__0");
					put(grammarAccess.getGDomainElementAccess().getGroup(), "rule__GDomainElement__Group__0");
					put(grammarAccess.getGDomainElementAccess().getGroup_2(), "rule__GDomainElement__Group_2__0");
					put(grammarAccess.getGDomainElementAccess().getGroup_2_2(), "rule__GDomainElement__Group_2_2__0");
					put(grammarAccess.getGDomainMapAccess().getGroup(), "rule__GDomainMap__Group__0");
					put(grammarAccess.getGDomainPropertyAccess().getGroup(), "rule__GDomainProperty__Group__0");
					put(grammarAccess.getGDomainPropertyAccess().getGroup_0_0(), "rule__GDomainProperty__Group_0_0__0");
					put(grammarAccess.getGDomainPropertyAccess().getGroup_0_0_3(), "rule__GDomainProperty__Group_0_0_3__0");
					put(grammarAccess.getGDomainPropertyAccess().getGroup_0_1(), "rule__GDomainProperty__Group_0_1__0");
					put(grammarAccess.getQualifiedNameAccess().getGroup(), "rule__QualifiedName__Group__0");
					put(grammarAccess.getQualifiedNameAccess().getGroup_1(), "rule__QualifiedName__Group_1__0");
					put(grammarAccess.getGModelAccess().getNameAssignment_1(), "rule__GModel__NameAssignment_1");
					put(grammarAccess.getGModelAccess().getTypeListAssignment_3(), "rule__GModel__TypeListAssignment_3");
					put(grammarAccess.getGDomainElementAccess().getNameAssignment_1(), "rule__GDomainElement__NameAssignment_1");
					put(grammarAccess.getGDomainElementAccess().getSuperTypeListAssignment_2_1(), "rule__GDomainElement__SuperTypeListAssignment_2_1");
					put(grammarAccess.getGDomainElementAccess().getSuperTypeListAssignment_2_2_1(), "rule__GDomainElement__SuperTypeListAssignment_2_2_1");
					put(grammarAccess.getGDomainElementAccess().getMapAssignment_4_0(), "rule__GDomainElement__MapAssignment_4_0");
					put(grammarAccess.getGDomainElementAccess().getPropertyListAssignment_4_1(), "rule__GDomainElement__PropertyListAssignment_4_1");
					put(grammarAccess.getGDomainMapAccess().getBuiltInAssignment_1_0(), "rule__GDomainMap__BuiltInAssignment_1_0");
					put(grammarAccess.getGDomainMapAccess().getRefAssignment_1_1(), "rule__GDomainMap__RefAssignment_1_1");
					put(grammarAccess.getGDomainPropertyAccess().getBuiltInAssignment_0_0_0(), "rule__GDomainProperty__BuiltInAssignment_0_0_0");
					put(grammarAccess.getGDomainPropertyAccess().getListAssignment_0_0_1(), "rule__GDomainProperty__ListAssignment_0_0_1");
					put(grammarAccess.getGDomainPropertyAccess().getNameAssignment_0_0_2(), "rule__GDomainProperty__NameAssignment_0_0_2");
					put(grammarAccess.getGDomainPropertyAccess().getDefaultValueAssignment_0_0_3_1(), "rule__GDomainProperty__DefaultValueAssignment_0_0_3_1");
					put(grammarAccess.getGDomainPropertyAccess().getRefAssignment_0_1_0(), "rule__GDomainProperty__RefAssignment_0_1_0");
					put(grammarAccess.getGDomainPropertyAccess().getListAssignment_0_1_1(), "rule__GDomainProperty__ListAssignment_0_1_1");
					put(grammarAccess.getGDomainPropertyAccess().getNameAssignment_0_1_2(), "rule__GDomainProperty__NameAssignment_0_1_2");
					put(grammarAccess.getGDefaultAccess().getStringValAssignment_0(), "rule__GDefault__StringValAssignment_0");
					put(grammarAccess.getGDefaultAccess().getIntValAssignment_1(), "rule__GDefault__IntValAssignment_1");
				}
			};
		}
		return nameMappings.get(element);
	}
	
	@Override
	protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
		try {
			org.eclipse.fx.ide.gmodel.ui.contentassist.antlr.internal.InternalGModelDSLParser typedParser = (org.eclipse.fx.ide.gmodel.ui.contentassist.antlr.internal.InternalGModelDSLParser) parser;
			typedParser.entryRuleGModel();
			return typedParser.getFollowElements();
		} catch(RecognitionException ex) {
			throw new RuntimeException(ex);
		}		
	}
	
	@Override
	protected String[] getInitialHiddenTokens() {
		return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" };
	}
	
	public GModelDSLGrammarAccess getGrammarAccess() {
		return this.grammarAccess;
	}
	
	public void setGrammarAccess(GModelDSLGrammarAccess grammarAccess) {
		this.grammarAccess = grammarAccess;
	}
}
